import { post, remove, get, put } from './api'
// import { read } from '../store/modules/init.js'

// 添加组织架构
export const add = (structObj) => {
    const url = '/usermgt/org_struct'
    const body = {
        method: 'add',
        args: JSON.stringify(structObj)
    }
    return post(url, body)
}

// 修改单个组织架构
export const update = (id, structObj) => {
    const url = `/usermgt/org_struct/${id}`
    const body = {
        method: 'update',
        args: JSON.stringify(structObj)
    }
    return put(url, body)
}

// 获取所有组织架构
export const getOrgStructList = () => {
    const url = `/usermgt/org_struct`
    return get(url)
}

// 获取单个组织架构详情
export const getOrgStructDetail = (id) => {
    const url = `/usermgt/org_struct/${id}`
    return get(url)
}

// 删除单个组织架构
export const delOrgStruct = (id) => {
    const url = `/usermgt/org_struct/${id}`
    return remove(url)
}
